﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SharingCenter.Web.Mod.Groups.Albums
{
    using SharingCenter.Web.Classes;
    using SharingCenter.Web.Classes.Events;
    using SharingCenter.Web.Classes.Albums;
    public partial class Upload : GroupsPageBase
    {
        Guid albumId;
        protected AlbumsWithCoverImage album;

        protected void Page_Init(object sender, EventArgs e)
        {
            ParseGroupIdFromQueryString();
            HasRights(groupId, Profile.UserId);
            if (Request.QueryString["aid"] == null || Request.QueryString["aid"] == string.Empty)
            {
                RedirecToGroupHomePage(groupId);
            }
            else
            {
                try
                {
                    albumId = new Guid(Request.QueryString["aid"]);
                }
                catch { RedirecToGroupHomePage(groupId); }
            }
            album = AlbumOperations.GetAlbum(albumId);

            AlbumUpload1.OkButtonClicked += new EventHandler<EventArgs>(AlbumUpload1_OkButtonClicked);
        }

        void AlbumUpload1_OkButtonClicked(object sender, EventArgs e)
        {
            SetTopMostMessage("相片添加成功。", true);
            Response.Redirect(string.Format("Album.aspx?aid={0}&id={1}", albumId, groupId));
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
